﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NGUYENTHUTRANG.OOP.MVC.ex4
{
    class Models4
    {
        //1.kết quả trả về
        int day;
        //2. thực thi lệnh
        public int daynumber(Entity4 en)
        {
            if(en.year % 4==0 && en.year%400==0)
            {
                switch(en.month%12)
                {
                    case 0: day = 31;
                        break;
                    case 1: day = 31;
                        break;
                    case 2: day = 29;
                        break;
                    case 3: day = 31;
                        break;
                    case 4: day = 30;
                        break;
                    case 5: day = 31;
                        break;
                    case 6: day = 30;
                        break;
                    case 7: day = 31;
                        break;
                    case 8: day = 31;
                        break;
                    case 9: day = 30;
                        break;
                    case 10: day = 31;
                        break;
                    case 11: day = 30;
                        break;
                   
                    

                }
            }
            else
            {
                switch (en.month % 12)
                {
                    case 0: day = 31;
                        break;
                    case 1: day = 31;
                        break;
                    case 2: day = 28;
                        break;
                    case 3: day = 31;
                        break;
                    case 4: day = 30;
                        break;
                    case 5: day = 31;
                        break;
                    case 6: day = 30;
                        break;
                    case 7: day = 31;
                        break;
                    case 8: day = 31;
                        break;
                    case 9: day = 30;
                        break;
                    case 10: day = 31;
                        break;
                    case 11: day = 30;
                        break;
                }

            }
            return day;
        }
    }
}
